package com.nny.alarm.menu;

import com.nny.alarm.R;
import com.umeng.analytics.MobclickAgent;

import android.content.Context;
import android.content.Intent;


public class MainMenuAction implements MainMenu.OnWindowEventListener
{
	Context mCtx;
	public MainMenuAction(Context ctx)
	{
		mCtx = ctx;
	}
	
	@Override
	public void onExit(int code)
	{
		switch (code)
		{
		case 0:
			MobclickAgent.onEvent(mCtx, "share", "menu");
			share(mCtx);break;	
		case 1:
			MobclickAgent.onEvent(mCtx, "help", "menu");
			help(mCtx);break;	
		case 2:
			MobclickAgent.onEvent(mCtx, "about", "menu");
			about(mCtx);break;		
		default:
			break;
		}
	}

	public static void settings(Context ctx)
	{
		ctx.startActivity(null);
	}

	public static void about(Context ctx)
	{
		startActivity(ctx, AboutActivity.class);
	}
	
	public static void help(Context ctx)
	{
		startActivity(ctx, HelpActivity.class);
	}
	
	public static void share(Context ctx)
	{
		Intent intent = new Intent();
		intent.setAction(Intent.ACTION_SEND);
		intent.setType("text/plain");
		intent.putExtra(Intent.EXTRA_TEXT,
				ctx.getString(R.string.share_content));
		ctx.startActivity(intent);
	}
	
	public static void startActivity(Context ctx, Class<?> cls)
	{
		Intent i = new Intent(ctx, cls);
		i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		ctx.startActivity(i);
	}
	
	
	
	
}
